<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>商家管理</title>
<style type="text/css">
.box.login {
	height: 100%;
	width: 80%;
	position: absolute;
	margin: 10% 10%;
}

.hhh.table {
	border-collapse: collapse;
}

th {
	width: 100px;
	height: 50px;
}

th, td {
	/*border: 1px solid gray;*/
	border-top: 1px solid #7b9ebd;
	height: 100px;
	text-align: center;
}

.pic {
	width: 100px;
	higth: 100px;
}

.even {
	background-color: #ddd;
}

.odd {
	
}

.btn {
	display: block;
}
</style>


</head>
<body>
	<form class="box login" action="login" method="post">
		<div>
			<h3>商家管理</h3>
			<a href="paging?targetPage=1">首页</a> 
			<a href="paging?targetPage=${curPage-1 }">
				<c:if test="${curPage==1 }">到顶了</c:if>
				<c:if test="${curPage!=1 }">上一页</c:if>
			</a> 
			<a href="paging?targetPage=${curPage+1 }">
				<c:if test="${curPage==pageSum }">到底了</c:if>
				<c:if test="${curPage!=pageSum }">下一页</c:if>
			</a> 
			<a href="paging?targetPage=${pageSum }">尾页</a> 第${curPage }页/共${pageSum }页
		</div>
		<table class="hhh table">
			<tr>
				<th>编号</th>
				<th>姓名</th>
				<th>电话</th>
				<th>身份证号码</th>
				<th>身份证图片</th>
				<th>地址</th>
				<th>品牌</th>
				<th>logo</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
			<c:forEach var="mer" items="${sessionScope.mers}" begin="${(curPage-1)*pageSize }" end= "${(curPage)*pageSize -1 }" varStatus="state">
				<c:if test="${state.index%2==0 }">
					<tr class=even>
						<td>${mer.mId }</td>
						<td>${mer.mPersonName }</td>
						<td>${mer.mTel }</td>
						<td>${mer.mIdCard }</td>
						<td><a href="${mer.mCardPath }" target=_blank><img
								alt="商家身份证" src=${mer.mCardPath } class="pic"></a></td>
						<td>${mer.mLocation }</td>
						<td>${mer.mBrand }</td>
						<td><a href="http://10.222.232.159/a.jpg" target=_blank><img
								alt="商家logo" src="http://10.222.232.159/a.jpg" class="pic"></a></td>
						<td><c:choose>
								<c:when test="${mer.mStatus==1 }">
							待审核
						</c:when>
								<c:when test="${mer.mStatus==2 }">
							已通过
						</c:when>
								<c:when test="${mer.mStatus==3 }">
							已拉黑
						</c:when>
								<c:when test="${mer.mStatus==4 }">
							审核未通过
						</c:when>
								<c:otherwise>
							error
						</c:otherwise>
							</c:choose></td>
						<td><c:choose>
								<c:when test="${mer.mStatus==1 }">
									<a href="updatepermission?mId=${mer.mId }&status=2">通过</a>|
						<a href="updatepermission?mId=${mer.mId }&status=4">拒绝</a>
								</c:when>
								<c:when test="${mer.mStatus==2 }">
									<a href="updatepermission?mId=${mer.mId }&status=3">拉黑</a>
								</c:when>
								<c:when test="${mer.mStatus==3 }">
									<a href="updatepermission?mId=${mer.mId }&status=2">恢复</a>
								</c:when>
								<c:when test="${mer.mStatus==4 }">
									<a href="updatepermission?mId=${mer.mId }&status=1">重新审核</a>
								</c:when>
								<c:otherwise>
							error
						</c:otherwise>
							</c:choose></td>

					</tr>
				</c:if>
				<c:if test="${state.index%2==1 }">
					<tr class="odd">
						<td>${mer.mId }</td>
						<td>${mer.mPersonName }</td>
						<td>${mer.mTel }</td>
						<td>${mer.mIdCard }</td>
						<td><a href="${mer.mCardPath }" target=_blank><img
								alt="商家身份证" src=${mer.mCardPath } class="pic"></a></td>
						<td>${mer.mLocation }</td>
						<td>${mer.mBrand }</td>
						<td><a href="${mer.mLogoPath }" target=_blank><img
								alt="商家logo" src=${mer.mLogoPath } class="pic"></a></td>
						<td><c:choose>
								<c:when test="${mer.mStatus==1 }">
							待审核
						</c:when>
								<c:when test="${mer.mStatus==2 }">
							已通过
						</c:when>
								<c:when test="${mer.mStatus==3 }">
							已拉黑
						</c:when>
								<c:when test="${mer.mStatus==4 }">
							审核未通过
						</c:when>
								<c:otherwise>
							error
						</c:otherwise>
							</c:choose></td>
						<td><a
							href="updatepermission?mId=${mer.mId }&status=${mer.mStatus}">
								<c:choose>
									<c:when test="${mer.mStatus==1 }">
										<a href="updatepermission?mId=${mer.mId }&status=2">通过</a>|
										<a href="updatepermission?mId=${mer.mId }&status=4">拒绝</a>
									</c:when>
									<c:when test="${mer.mStatus==2 }">
										<a href="updatepermission?mId=${mer.mId }&status=3">拉黑</a>
									</c:when>
									<c:when test="${mer.mStatus==3 }">
										<a href="updatepermission?mId=${mer.mId }&status=2">恢复</a>
									</c:when>
									<c:when test="${mer.mStatus==4 }">
										<a href="updatepermission?mId=${mer.mId }&status=1">重新审核</a>
									</c:when>
									<c:otherwise>
							error
						</c:otherwise>
								</c:choose>
						</a></td>

					</tr>
				</c:if>
			</c:forEach>
		</table>
		<button class="btn" type="submit" formaction="refresh">获取最新数据</button>

	</form>
</body>
</html>